⚙️ [Maintenance]: Partial test reruns no longer fail when shared infrastructure has been torn down#594
Conversation
No Significant Changes DetectedThis PR does not contain changes to files that would trigger a new release:
Build, test, and publish stages will be skipped for this PR. If you believe this is incorrect, please verify that your changes are in the correct locations. |
No Significant Changes DetectedThis PR does not contain changes to files that would trigger a new release:
Build, test, and publish stages will be skipped for this PR. If you believe this is incorrect, please verify that your changes are in the correct locations. |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
There was a problem hiding this comment.
Pull request overview
Improves CI robustness for Process-PSModule.yml partial reruns by making leaf test jobs idempotently recreate the shared run-scoped test repositories if AfterAll-ModuleLocal has already torn them down (fixing #590).
Changes:
- Add
tests/Data/SharedTestRepositories.ps1with idempotent get-or-create helpers for shared test repos (including-2/-3org extras). - Update global
tests/BeforeAll.ps1to provision shared repos via the new helpers (same path as leaf jobs). - Update several leaf test files to dot-source the helper and replace “get-or-throw” repo resolution with
Initialize-SharedTestRepository(and extras helper where needed).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Data/SharedTestRepositories.ps1 | New idempotent helpers to get-or-create shared run-scoped repositories (with race recovery). |
| tests/BeforeAll.ps1 | Switches global provisioning to use the new helpers. |
| tests/Actions.Tests.ps1 | Leaf job now initializes shared repo declaratively for rerun self-heal. |
| tests/Environments.Tests.ps1 | Leaf job now initializes shared repo declaratively for rerun self-heal. |
| tests/Releases.Tests.ps1 | Leaf job now initializes shared repo declaratively for rerun self-heal. |
| tests/Secrets.Tests.ps1 | Leaf job now initializes shared repo declaratively; org extras created via helper. |
| tests/Variables.Tests.ps1 | Leaf job now initializes shared repo declaratively; org extras created via helper. |
No Significant Changes DetectedThis PR does not contain changes to files that would trigger a new release:
Build, test, and publish stages will be skipped for this PR. If you believe this is incorrect, please verify that your changes are in the correct locations. |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
No Significant Changes DetectedThis PR does not contain changes to files that would trigger a new release:
Build, test, and publish stages will be skipped for this PR. If you believe this is incorrect, please verify that your changes are in the correct locations. |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
No Significant Changes DetectedThis PR does not contain changes to files that would trigger a new release:
Build, test, and publish stages will be skipped for this PR. If you believe this is incorrect, please verify that your changes are in the correct locations. |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
No Significant Changes DetectedThis PR does not contain changes to files that would trigger a new release:
Build, test, and publish stages will be skipped for this PR. If you believe this is incorrect, please verify that your changes are in the correct locations. |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
No Significant Changes DetectedThis PR does not contain changes to files that would trigger a new release:
Build, test, and publish stages will be skipped for this PR. If you believe this is incorrect, please verify that your changes are in the correct locations. |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
… on existing repos
No Significant Changes DetectedThis PR does not contain changes to files that would trigger a new release:
Build, test, and publish stages will be skipped for this PR. If you believe this is incorrect, please verify that your changes are in the correct locations. |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
…ns docs TEMPLATE.ps1 and both code snippets in tests.instructions.md were missing the if-guard for OwnerType values 'repository' and 'enterprise' that all actual test files already use. Without it the template's switch falls through silently, returning without making it explicit, and the instructions guide readers toward a pattern that omits the guard.
No Significant Changes DetectedThis PR does not contain changes to files that would trigger a new release:
Build, test, and publish stages will be skipped for this PR. If you believe this is incorrect, please verify that your changes are in the correct locations. |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
…ests; restore tests/README.md as redirect
Secrets.Tests.ps1 and Variables.Tests.ps1 were missing the
if (\ -in ('repository','enterprise')) guard that all other
test files already have. Without it, \/\/\ were left
unset for those auth cases, risking stale-value reuse.
Re-add tests/README.md as a minimal pointer to the canonical
.github/instructions/tests.instructions.md so contributors browsing
tests/ still find the documentation entry point.
No Significant Changes DetectedThis PR does not contain changes to files that would trigger a new release:
Build, test, and publish stages will be skipped for this PR. If you believe this is incorrect, please verify that your changes are in the correct locations. |
Super-linter summary
All files and directories linted successfully For more information, see the GitHub Actions workflow run Powered by Super-linter |
Re-running individual failed leaf jobs in
Process-PSModule.ymlnow succeeds even afterAfterAll-ModuleLocalhas deleted the shared test repositories. Each leaf-testBeforeAllblock now usesSet-GitHubRepository(which is already idempotent — get-or-create) instead ofGet-GitHubRepositoryfollowed by a throw on missing, so a partial rerun with Re-run failed jobs no longer requires re-executing every successful sibling job to rebuild infrastructure.Fixed: Partial reruns of
Test-ModuleLocalmatrix jobsPreviously, when one or more leaf jobs failed transiently and the workflow proceeded to
AfterAll-ModuleLocal, the sharedTest-{OS}-{TokenType}-{RunID}repositories were deleted. Clicking Re-run failed jobs then failed every reran leaf job in itsBeforeAll, because successfulneeds(includingBeforeAll-ModuleLocal) are not re-executed by GitHub Actions on a partial rerun.Leaf-test
BeforeAllblocks now callSet-GitHubRepository— the module's own idempotent get-or-create function — instead ofGet-GitHubRepositorywith a throw guard. On the happy path the repositories already exist andSet-GitHubRepositoryreturns them unchanged. On a partial rerun where the repositories were torn down, it recreates them transparently and proceeds.The run-scoped naming (
Test-{OS}-{TokenType}-{RunID}) and concurrent-run isolation guarantees from #541 are preserved.Technical Details
tests/BeforeAll.ps1now provisions repositories throughSet-GitHubRepositoryinstead ofNew-GitHubRepository, making global setup idempotent too (safe to re-run for the sameGITHUB_RUN_ID). The pre-clean of stale repositories from previous attempts is preserved.Actions.Tests.ps1,Environments.Tests.ps1,Releases.Tests.ps1,Secrets.Tests.ps1,Variables.Tests.ps1. Each replacesGet-GitHubRepository+ throw-on-missing with aSet-GitHubRepositorycall using the same parameters the globalBeforeAlluses (-AddReadme -License 'mit' -Gitignore 'VisualStudio'). For Secrets/Variables, the org-only-2/-3companion repositories follow the same pattern.Repositories.Tests.ps1is intentionally unchanged — it owns its own per-context lifecycle with a different naming scheme.tests/AfterAll.ps1is unchanged — the teardown contract is unaffected.Set-GitHubRepositoryalready provides the exact idempotent get-or-create semantics required.